package com.hex.ds.hdtp.core.inf.dqc.repository.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hex.ds.hdtp.core.inf.common.page.Page;
import com.hex.ds.hdtp.core.inf.common.page.converter.IPageAndMyBatisPlusPageConverter;
import com.hex.ds.hdtp.core.inf.dqc.mapper.IDqcTaskLogMapper;
import com.hex.ds.hdtp.core.inf.dqc.mapper.IDqcTaskMapper;
import com.hex.ds.hdtp.core.inf.dqc.po.DqcAuditLogPo;
import com.hex.ds.hdtp.core.inf.dqc.po.DqcTaskPo;
import com.hex.ds.hdtp.core.inf.dqc.repository.IDqcTaskLogRepository;
import com.hex.ds.hdtp.core.inf.dqc.repository.IDqcTaskRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class DqcTaskLogRepository implements IDqcTaskLogRepository {
    private final IDqcTaskLogMapper iDqcTaskLogMapper;

    private final IPageAndMyBatisPlusPageConverter pageConverter;
    @Override
    public DqcAuditLogPo queryById(String pkId) {
        return null;
    }

    @Override
    public Integer add(DqcAuditLogPo dqcAuditLogPo) {
        return iDqcTaskLogMapper.insert(dqcAuditLogPo);
    }

    @Override
    public Integer modifyById(DqcAuditLogPo dqcAuditLogPo) {
        return null;
    }

    @Override
    public Integer removeById(String pkId) {
        return null;
    }

    @Override
    public Page<DqcAuditLogPo> queryListByPage(DqcAuditLogPo dqcAuditLogPo, Page page) {
        IPage iPage = iDqcTaskLogMapper.queryListByPage(pageConverter.toMyBatisPlusPage(page), dqcAuditLogPo);
        List records = iPage.getRecords();
        Page pageResult = pageConverter.toPage(iPage);
        pageResult.setData(records);
        return pageResult;
    }
}
